package cn.edu.hunau.java.week03.day01;

import org.junit.Test;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;

public class FormateTimeTest {
    @Test
    public void test01(){
        LocalDate now=LocalDate.now();
        System.out.println(now);
        LocalDate of=LocalDate.of(2025,9,1);
    }
    @Test
    public void test02(){
        LocalDate now=LocalDate.now();
        String v1=now.format(DateTimeFormatter.ofPattern("yyyy'年'MM'月'dd'日'"));
        System.out.println(v1);
        String v2="2026/09/01";
        LocalDate date2=LocalDate.parse(v2,DateTimeFormatter.ofPattern("yyyy/MM/dd"));
        System.out.println(date2);
    }
    @Test
    public void test03(){
        LocalDate now=LocalDate.now();
        LocalDate v1=now.plusDays(10);
        System.out.println(v1);
        LocalDate v2=now.plusYears(1);
        System.out.println(v2);
        LocalDate v3=now.plus(3, ChronoUnit.MONTHS);
        System.out.println(v3);
        LocalDate v4=now.plus(30, ChronoUnit.DAYS);
        System.out.println(v4);
        LocalDate v5=now.minus(1, ChronoUnit.DAYS);
        System.out.println(v5);
    }
}
